{extend name="index/index"/}

{block name="body"}
<script type="text/javascript">
    $(document).ready(wechat_obj.classify);
    $(document).ready(common_obj.form_submit);
</script>

<header class="tab-head">
    <ul class="nav nav-tabs">
        <li class="">
            <a href="{:url('Wechat/wxevent')}">微信事件设置</a>
        </li>
        <li class="active">
            <a href="{:url('Wechat/classify')}">自定义菜单设置</a>
        </li>
    </ul>
</header>

<section class="wrapper" style="margin-top:0">
    <div class="row">
        <div class="col-lg-12">
            <section class="panel">
                <div class="panel-body">
                    <div class="form">
                        <form class="cmxform form-horizontal tasi-form" id="data-form">

                            <div class="form-group">
                                <div class="col-lg-12">
                                    <p class="btn btn-info classify-add">+添加菜单</p>
                                    <p class="btn btn-success classify-publish" data-url="{:url('Wechat/classifypublish')}">√发布菜单</p>
                                    <p class="btn btn-danger classify-del" data-url="{:url('Wechat/classifydel')}">×删除菜单</p>
                                </div>
                            </div>

                            <div class="form-group classify-tree">
                                {volist name="data.classify" id="vo" key="k"}

                                <div class="row li01 wechat-classify" data-pid="{$k}">

                                    <div class="col-lg-12 mbot-15 wechat-classify-one">
                                        <div class="col-lg-4 col-xs-12 col-sm-12 col-md-6">
                                            <input class="form-control first" type="text" name="name_0[]" value="{$vo.name}" required="required"/>
                                            <input class="form-control second" type="hidden" name="type_0[]" value="{$vo.type ? $vo.type : ''}"/>
                                            <input class="form-control third" type="hidden" name="content_0[]"
                                                   value="{$vo.content ? $vo.content : ''}"/>
                                        </div>
                                        <div class="col-lg-8 menu col-xs-12 col-sm-12 col-md-6">
                                            <a href="javascript:;"><i class="icon-comments"></i></a>

                                            <a href="javascript:;" class="wechat-classify-one-setting" {$vo.sub_button ? 'style="display:none"':''}><i
                                                class="icon-pencil"></i>设置此菜单动作</a>

                                            <a href="javascript:;" class="wechat-classify-one-del"><i class="icon-remove"></i>删除此菜单</a>
                                            <a href="javascript:;" class="wechat-classify-one-addchild"><i class="icon-plus"></i>添加子菜单</a>
                                        </div>
                                    </div>
                                    {if condition="isset($vo.sub_button)"}
                                    {volist name="vo.sub_button" id="v"}
                                    <div class="col-lg-12 mbot-15 wechat-classify-two">
                                        <div class="col-lg-4 col-xs-12 col-sm-12 col-md-6">
                                            <div class="col-lg-2 col-xs-5 col-sm-3 col-md-2 padding0">
                                                <img src="__STATIC__/member/bootstrap/img/bg_repno.gif" class="sectionimg">
                                            </div>
                                            <div class="col-xs-7 col-sm-9 col-md-10 col-lg-10  padding0">
                                                <input class="form-control first" type="text" name="name_{$k}[]" value="{$v.name}"
                                                       required="required"/>
                                                <input class="form-control second" type="hidden" name="type_{$k}[]" value="{$v.type}"/>
                                                <input class="form-control third" type="hidden" name="content_{$k}[]" value="{$v.content}"/>
                                            </div>
                                        </div>
                                        <div class="col-lg-8 menu col-xs-12 col-sm-12 col-md-6">
                                            <a href="javascript:;"><i class="icon-comments"></i></a>
                                            <a href="javascript:;" class="wechat-classify-two-setting"><i class="icon-pencil"></i>设置此菜单动作</a>
                                            <a href="javascript:;" class="wechat-classify-two-del"><i class="icon-remove"></i>删除此菜单</a>
                                        </div>
                                    </div>
                                    {/volist}
                                    {/if}
                                </div>
                                {/volist}
                            </div>

                            <div class="form-group">
                                <div class="col-lg-offset-2 col-lg-10">
                                    <input class="btn btn-danger" type="submit" value="提交保存">
                                </div>
                            </div>
                            <input type="hidden" name="id" value="{$data.id}">
                        </form>
                        <input type="hidden" id="do_action" value="{:url('Wechat/classify')}">
                    </div>
                </div>
            </section>
        </div>
    </div>
</section>

<!--一级菜单-->
<div class="row li01 wechat-classify-demo" style="display: none">
    <div class="col-lg-12 mbot-15 wechat-classify-one">
        <div class="col-lg-4 col-xs-12 col-sm-12 col-md-6">
            <input class="form-control first" type="text" name="name_0[]" required="required"/>
            <input class="form-control second" type="hidden" name="type_0[]"/>
            <input class="form-control third" type="hidden" name="content_0[]"/>
        </div>
        <div class="col-lg-8 menu col-xs-12 col-sm-12 col-md-6">
            <a href="javascript:;"><i class="icon-comments"></i></a>
            <a href="javascript:;" class="wechat-classify-one-setting"><i class="icon-pencil"></i>设置此菜单动作</a>
            <a href="javascript:;" class="wechat-classify-one-del"><i class="icon-remove"></i>删除此菜单</a>
            <a href="javascript:;" class="wechat-classify-one-addchild"><i class="icon-plus"></i>添加子菜单</a>
        </div>
    </div>
</div>

<!--二级菜单-->
<div class="col-lg-12 mbot-15 wechat-classify-two-demo" style="display: none">
    <div class="col-lg-4 col-xs-12 col-sm-12 col-md-6">
        <div class="col-lg-2 col-xs-5 col-sm-3 col-md-2 padding0">
            <img src="__STATIC__/member/bootstrap/img/bg_repno.gif" class="sectionimg">
        </div>
        <div class="col-xs-7 col-sm-9 col-md-10 col-lg-10  padding0">
            <input class="form-control first" type="text" required="required"/>
            <input class="form-control second" type="hidden"/>
            <input class="form-control third" type="hidden"/>
        </div>
    </div>
    <div class="col-lg-8 menu col-xs-12 col-sm-12 col-md-6">
        <a href="javascript:;"><i class="icon-comments"></i></a>
        <a href="javascript:;" class="wechat-classify-two-setting"><i class="icon-pencil"></i>设置此菜单动作</a>
        <a href="javascript:;" class="wechat-classify-two-del"><i class="icon-remove"></i>删除此菜单</a>
    </div>
</div>

<!--设置菜单-->
<div class="layer classify-layer" style="display: none;">
    <div class="layerer"></div>
    <div class="row" style="height: 70%;">
        <div class="col-sm-6 col-sm-offset-3 col-xs-8 col-xs-offset-2" style="height: 100%;position: relative;z-index:39999;">
            <section class="panel" style="height: 100%;">
                <div class="row title">
                    <div class="col-xs-8">
                        <p class="title1 classify-name">选择菜单要执行的操作</p>
                    </div>
                    <div class="col-xs-4">
                        <p class="title1 text-right classify-layer-close">
                            <button class="close close-sm" type="button">
                                <i class="icon-remove"></i>
                            </button>
                        </p>
                    </div>
                </div>
                <div class="row" style="height: 90%;overflow-y: scroll;overflow-x: hidden;">
                    <div class="col-lg-12">
                        <form class="form-horizontal tasi-form" id="reply-form">
                            <section class="panel">
                                <div class="panel-body">
                                    <div class="form-group">
                                        <div class="col-lg-12">
                                            <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6">
                                                <label class="radio-inline">
                                                    <input type="radio" name="type" value="click">触发关键字
                                                </label>
                                            </div>
                                            <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6">
                                                <label class="radio-inline">
                                                    <input type="radio" name="type" value="view">跳转URL
                                                </label>
                                            </div>
                                            <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6">
                                                <label class="radio-inline">
                                                    <input type="radio" name="type" value="scancode_push">扫码推事件
                                                </label>
                                            </div>
                                            <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6">
                                                <label class="radio-inline">
                                                    <input type="radio" name="type" value="scancode_waitmsg">扫码推事件(等待信息)
                                                </label>
                                            </div>
                                            <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6">
                                                <label class="radio-inline">
                                                    <input type="radio" name="type" value="pic_sysphoto">弹出系统拍照发图
                                                </label>
                                            </div>
                                            <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6">
                                                <label class="radio-inline">
                                                    <input type="radio" name="type" value="pic_photo_or_album">弹出拍照或者相册发图
                                                </label>
                                            </div>
                                            <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6">
                                                <label class="radio-inline">
                                                    <input type="radio" name="type" value="pic_weixin">弹出微信相册发图器
                                                </label>
                                            </div>
                                            <div class="col-lg-4 col-md-4 col-sm-6 col-xs-6">
                                                <label class="radio-inline">
                                                    <input type="radio" name="type" value="location_select">弹出地理位置
                                                </label>
                                            </div>
                                        </div>
                                    </div>

                                    <div class="form-group">
                                        <div class="col-lg-12 reply-click" style="display:none">
                                            <select class="form-control mbot20" name="keywords_id">
                                                {volist name="keywordsList" id="vo"}
                                                <option value="{$vo.id}">
                                                    {if condition="$vo.type == 'text'"}【文本消息】
                                                    {elseif condition="$vo.type == 'news'"/}【图文消息】
                                                    {elseif condition="$vo.type == 'image'"/}【图片消息】
                                                    {/if}
                                                    {$vo.name}
                                                </option>
                                                {/volist}
                                            </select>
                                        </div>
                                        <div class="col-lg-12 reply-view" style="display:none">
                                            <input type="text" class="form-control mbot20" name="name">
                                        </div>

                                        <div class="col-lg-12 info">
                                            指定点击此菜单时要执行的操作, 你可以在这里输入关键字, 那么点击这个菜单时就就相当于发送这个内容至系统
                                        </div>
                                        <!--<div class="col-lg-12 info1">
                                            这个过程是程序模拟的, 比如这里添加关键字: 优惠券, 那么点击这个菜单是, 系统系统相当于接受了粉丝用户的消息, 内容为"优惠券"
                                        </div>-->
                                    </div>

                                    <div class="form-group text-right">
                                        <div class="col-lg-12">
                                            <input type="submit" class="btn btn-success" value="保存">
                                        </div>
                                    </div>
                                </div>
                            </section>

                        </form>
                    </div>
                </div>
            </section>
        </div>
    </div>
</div>

{/block}
